<!--!
This file is a part of MediaDrop (http://www.mediadrop.net),
Copyright 2009-2013 MediaCore Inc., Felix Schwarz and other contributors.
For the exact contribution history, see the git revision log.
The source code contained in this file is licensed under the GPLv3 or
(at your option) any later version.
See LICENSE.txt in the main project directory, for more information.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="../settings/master.html" />
<head>
	<title>Players</title>
	<script src="${h.url_for('/scripts/third-party/squeezebox-1.1-rc4-yui-compressed.js')}" type="text/javascript"></script>
	<link href="${h.url_for('/admin/styles/squeezebox.css')}" media="screen" rel="stylesheet" type="text/css" />
	<link href="${h.url_for('/admin/styles/players.css')}" media="screen" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="${h.url_for('/admin/scripts/confirm.js')}"></script>
	<script type="text/javascript">
		//<![CDATA[
		window.addEvent('domready', function(){
			var deleteConfirm = new DeleteConfirmMgr({
				header: '${_('Confirm Delete').replace("'", "\\'")}',
				msg: '${_('By deleting this player you will lose all settings related to it.').replace("'", "\\'")}<br />${_('Are you sure you want to delete this?')}',
				confirmButtonText: '${_('Delete').replace("'", "\\'")}',
				cancelButtonText: '${_('Cancel').replace("'", "\\'")}'
			});
			$$$$('.delete-player-form .delete').each(function(el) {
				el.addEvent('click', deleteConfirm.openConfirmDialog.bind(deleteConfirm));
			});
		});
		//]]>
	</script>
</head>
<body>
	<div class="box">
		<div class="box-head">
			<h1>Players</h1>
			<!--!<a id="add-engine-btn" href="${h.url_for(action='edit', id='new')}" class="btn inline f-rgt"><span>Add Player</span></a>-->
			<!--!<span class="box-head-sec">${h.doc_link('admin/settings', 'storage')}</span>-->
		</div>
		<table cellpadding="0" cellspacing="0" id="players-table" class="status-table">
			<thead>
				<tr>
					<th id="h-status" style="width:40px">Status</th>
					<th id="h-display_name" style="width:auto">Name</th>
					<th id="h-priority" style="width:70px;text-align:center">Priority</th>
					<th id="h-btns" style="width:63px">&nbsp;</th>
				</tr>
			</thead>
			<tbody>
				<tr py:if="len(players) == 0">
					<td>None Found</td>
				</tr>
				<tr py:for="player in players">
					<td headers="h-status" py:with="enabled = player.enabled and _('Enabled (disable)') or _('Disabled (enable)')">
						<form action="${h.url_for(action=player.enabled and 'disable' or 'enable', id=player.id)}" method="post">
							<div>
								<button class="${player.enabled and 'status-enabled' or 'status-disabled'}" type="submit" value="${enabled}" title="${enabled}">${enabled}</button>
							</div>
						</form>
					</td>
					<td headers="h-display_name">
						<a href="${h.url_for(action='edit', id=player.id)}" py:content="_(player.display_name)" py:strip="not player.settings_form">Display Name</a>
					</td>
					<td headers="h-priority" style="text-align:center">
						<form class="arrows" action="${h.url_for(action='reorder', id=player.id)}" method="post">
							<div>
								<button class="uparrow" type="submit" name="direction" value="up">${_('Up')}</button>
								<button class="downarrow" type="submit" name="direction" value="down">${_('Down')}</button>
							</div>
						</form>
					</td>
					<td headers="h-btns" py:with="show_edit = player.settings_form is not None; delete_class = show_edit and 'delete' or 'delete-solo'">
						<form action="${h.url_for(action='delete', id=player.id)}" method="post" class="delete-player-form right">
							<a py:if="show_edit" href="${h.url_for(action='edit', id=player.id)}" class="btn table-row middle"><span>Edit</span></a><button class="btn table-row ${delete_class}" type="submit" name="delete"><span>Delete</span></button>
						</form>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
</body>
</html>
